package com.swind.fast.modules.app.halali.partner.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import com.swind.fast.modules.app.halali.partner.entity.Order;
import com.swind.fast.modules.app.halali.partner.entity.Restaurant;
import com.swind.fast.modules.app.halali.partner.entity.RestaurantOperation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.time.LocalTime;
import java.time.LocalDateTime;

/**
 * @Description: 项目
 * @Author: swind
 * @Date:   2021-11-20
 * @Version: V1.0
 */
public interface RestaurantMapper extends BaseMapper<Restaurant> {

    @Select("select * from halali_restaurant_operation where restaurant_id=#{restaurantId}")
    public RestaurantOperation queryOperationByRestaurantId(@Param("restaurantId") String restaurantId);

    @Select("select sum(total_price) from halali_order where restaurant_id=#{restaurantId}")
    public String sumTotalOrderPriceByRestaurantId(@Param("restaurantId") String restaurantId);

    @Select("select * from halali_order where restaurant_id=#{restaurantId} and create_time > #{startOfToday}")
    public List<Order> queryTodayOrderByRestaurantId(
            @Param("restaurantId") String restaurantId,
            @Param("startOfToday") LocalDateTime startOfToday
        );
}
